<template>
    <Layout>
        <Form ref="queryForm" :model="dataToQuery" :label-width="120">
            <Row v-show="!switchFlag" class="query-form">
                <Col span="8">
                    <FormItem label="通知类型：">
                        <Input class='query-form-el' type='text' v-model='dataToQuery.expireWarnType'/>
                    </FormItem>
                </Col>
                <Col span="8" offset="8">
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button type="primary" class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                </Col>
            </Row>
        </Form>
        <Table ref='table' :height="tableHeight" no-data-text="没有查询到相关数据!" @on-selection-change='getSelectRows'
               :loading='pageStatus.loading'
               border :columns="columns1" :data="dataTable">
        </Table>
        <Row style="margin-right:10px;">
            <Col span="24">
                <Page style="float: right" :total="pagedata.total" :page-size="pagedata.pageSize"
                      @on-change="pageChange" @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray"
                      show-total show-sizer show-elevator/>
            </Col>
        </Row>

    </Layout>
</template>

<script>
    import {Api} from '@/api/index.js'
    var cascaderDom = () => import('@/components/cascader-dom.vue');
    import {sessionStorage, cookie} from '@/common/cacheUtils.js';
    import pageCommonFunction from '@/components/pageCommonFunction.js'

    export default {
        components: {cascaderDom},
        data() {
            return {
                ...this.createCommonDataField(),
                columns1: [
                    {title: '序号', width: 80, fixed: 'left', align: 'center', render: this.indexColumnsRender},
                    {key: 'expireWarnType', title: '到期提醒类型', align: 'center', minWidth: 160,},
                    {key: 'expireDate', title: '业务实际到期时间', align: 'center', minWidth: 120,},
                    {key: 'noticeUserId', title: '通知人员', align: 'center', minWidth: 120,},
                    {key: 'noticeText', title: '通知内容', align: 'center', minWidth: 180,tooltip:true},
                    {
                        title: '操作',
                        key: 'action',
                        fixed: 'right',
                        width: 180,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('A', {
                                    props: {type: 'primary', size: 'small'},
                                    style: {fontSize: '14px',},
                                    on: {
                                        click: () => {
                                            this.viewData(params);
                                        }
                                    }
                                }, '详情'),
                                h('Divider', {props: {type: 'vertical'}}, ''),
                                h('A', {
                                    props: {type: 'primary', size: 'small'},
                                    style: {fontSize: '14px',},
                                    on: {
                                        click: () => {
                                            this.editData(params);
                                        }
                                    }
                                }, '修改'),
                               /* h('Divider', {props: {type: 'vertical'}}, ''),
                                h('A', {
                                    props: {type: 'primary', size: 'small'},
                                    style: {fontSize: '14px',},
                                    on: {
                                        click: () => {
                                            this.deleteData(params);
                                        }
                                    }
                                }, '删除')*/
                            ])
                        }
                    }
                ],
                tableHeight: 10,
                companyId:'',
                // api
                queryUrl: Api.queryExpireWarnNotice,
                // deleteUrl: Api.deleteSaStaffEnvinfo,
                // updateUrl: Api.updateSaStaffEnvinfo,
                // saveUrl: Api.saveSaStaffEnvinfo,
            }
        },
        mounted() {
            this.companyId=sessionStorage('userId').getObject('userId').companyId
            this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 145;
            this.query();
        },
        methods: {
            ...pageCommonFunction,

            deleteData(params) {
                params.row.id=params.row.staffId
                this.deleteDateAjax(params);
            },
            query() {
                if (this.dataToQuery.companyId != null) {
                    this.dataToQuery.orgId=this.dataToQuery.companyId
                }else {
                    this.dataToQuery.orgId = sessionStorage('userId').getObject('userId').companyId
                }
                this.queryAjax();
            },
            submit(name) {
                this.submitAjax(name);
            },

        },
        computed: {},

    }
</script>

<style lang='css' scoped>
    @import '../../../index.css';
</style>
